package com.pinapel.aixml.models.xml;

import java.io.ByteArrayInputStream;
import java.io.InputStream;
import java.io.UnsupportedEncodingException;
import com.pinapel.aixml.tools.OptionManager;

public class TextModel {
	private String mText = "";
	private String mEncoding = OptionManager.getDefaultEncoding(); 
	
	public TextModel(){
		
	}
	
	public TextModel(String in){
		mText = in;
	}
	public TextModel(String in, String encoding){
		mText = in;
		mEncoding = encoding;
	}
	
	
	public InputStream getInputStream(){
		InputStream res = null;
		try {
			res = new ByteArrayInputStream(mText.getBytes(mEncoding));
		} catch (UnsupportedEncodingException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		};		
		return res;
	}

	public String getText() {
		return mText;
	}

	public String getEncoding() {
		return mEncoding;
	}

	public void setText(String mText) {
		this.mText = mText;
	}

	public void setEncoding(String mEncoding) {
		this.mEncoding = mEncoding;
	}
	
	
}
